/*
 * @Author: zhangfeng
 * @Date: 2023-12-25 14:55:38
 * @LastEditTime: 2023-12-28 17:21:31
 * @LastEditors: zhangfeng
 * @Description:
 * @FilePath: \nodeapi\src\model\role-user.model.js
 * © 2023 张峰，All rights reserved.
 */
const { DataTypes } = require("sequelize");
const seq = require("../db/seq");

// 创建角色模型

const Roleuser = seq.define(
  "zd_role_user",
  {
    userId: {
      type: DataTypes.INTEGER,
      allowNull: true,
      primaryKey: true,
      comment: "用户id",
      references: {
        model: "zd_users",
        key: "id",
      },
    },
    roleId: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comments: "角色id",
      primaryKey: true,
      references: {
        model: "zd_roles",
        key: "id",
      },
    },
  },
  {
    tableName: "zd_role_users",
    timestamps: true,
    // paranoid: true,
  }
);

// Roleuser.sync({ force: false });

module.exports = Roleuser;
